<template>
	<view class="test1">
		
		
		<view >vuex的值 ： {{testvalue2}}</view>
		<input v-model="testvalue2" />
		
	 
		
		<button type="primary" @click="test1" size="mini">改变值</button>
		
		<button type="primary" @click="test2" size="mini">TOAST</button>
		
		<my-navbar></my-navbar>
	</view>
</template>

<script>
	
	import myNavbar from '../../components/my-navbar/my-navbar.vue'	
	
	import { mapState,mapMutations, mapActions, mapGetters } from 'vuex'
	
	export default {
		components: {
			myNavbar
		},
		data() {
			return {
				 testvalue : this.$store.state.testvalue
			}
		},
		computed: {
			//...mapState(['testvalue'])
			testvalue2: {
				get() {
					return this.$store.state.testvalue
				},
				set(val){
					this.$store.state.testvalue = val
				}
			}
		},
		onLoad() {
			// let value  = getApp().globalData.text = 'test';
			 
		},
		methods: {
			...mapMutations(['changeTest']),
			
			
			test2(){
				uni.showToast({
					title: 'eee',
					duration: 2000,
					icon:'none'
				})
			},
			
			test1(){
				//getApp().globalData.quantity = 200
				this.changeTest("wwww")				
			}
			
		}
	}
</script>

<style lang="scss">
	
	.test1{
		padding: 40rpx;
		
	}

</style>
